package com.imooc.shell.dataobject;

import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

/**
 * 类目  把数据库字段映射成实体类
 * product_category
 */
@Entity  //说明此java类是实体类
@Table(name = "product_category")
@Data // 自动 getXXX setXXX
@DynamicUpdate // 数据更新时自动更新 update_time
@DynamicInsert // 数据添加时自动更新 create_time
public class ProductCategory {

    /**
     * 类目id
     */
    @Id
    @GeneratedValue
    private Integer categoryId;
    /**
     * 类目名字
     */
    private String categoryName;
    /**
     * 类目编号
     */
    private Integer categoryType;
//    private Integer categoryType = 1; // 设定默认值

    private Date createTime;
    private Date updateTime;

    public ProductCategory(String categoryName, Integer categoryType) {
        this.categoryName = categoryName;
        this.categoryType = categoryType;
    }

    public ProductCategory() {
    }

}
